home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dirut / bm_rm.zip / GETMODE.ASM < prev    next >
Assembly Source File  |  1989-08-02  |  2KB  |  58 lines

  1. ;getmode() - Get the attributes of a specified file
  2. ;
  3. ;Syntax: int getmode (char *pathname);
  4. ;
  5. ;pathname = ASCIIZ pathname of file whose attributes are to be returned.
  6. ;
  7. ;Return value: -1 = file not found
  8. ;              Otherwise, high byte is zero and low byte holds attributes
  9. ;
  10. ;Copyright (C) 1989 Brian B. McGuinness
  11. ;                   15 Kevin Road
  12. ;                   Scotch Plains, NJ 07076
  13. ;
  14. ;This function is free software; you can redistribute it and/or modify it under 
  15. ;the terms of the GNU General Public License as published by the Free Software 
  16. ;Foundation; either version 1, or (at your option) any later version.
  17. ;
  18. ;This function is distributed in the hope that it will be useful, but WITHOUT 
  19. ;ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
  20. ;FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
  21. ;details.
  22. ;
  23. ;You should have received a copy of the GNU General Public License along with 
  24. ;this function; if not, write to the Free Software Foundation, Inc., 675 Mass 
  25. ;Ave, Cambridge, MA 02139, USA.
  26. ;
  27. ;Version 1.0          July, 1989          MASM 5.1
  28.  
  29.         DOSSEG
  30.         .MODEL small,C
  31.         .CODE
  32.  
  33. getmode proc uses ds cx dx, pathname:ptr
  34.  
  35. ;Get pointer to path name in DS:DX.
  36.  
  37. if @DataSize
  38.         lds dx,pathname         ;Far pointer
  39. else
  40.         mov ax,@data            ;Near pointer
  41.         mov ds,ax
  42.         mov dx,pathname
  43. endif
  44.  
  45.         mov ax,4300H            ;DOS "chmod" call.
  46.         int 21H
  47.         jnc @F
  48.         mov ax,-1
  49.         jmp short exit
  50.  
  51. @@:     mov ax,cx
  52.         xor ah,ah
  53.  
  54. exit:
  55.         ret
  56. getmode endp
  57.         end
  58.